// 服务器全部接口返回的数据类型
export interface ResponseData {
  code: number;
  message: string;
  ok: boolean;
}

// SPU数据的ts类型
export interface SpuData {
  id?: number;
  spuName: string;
  description: string;
  catalog3Id: number | string;
  tmId: number;
  spuSaleAttrList: null | SaleAttr[];
  spuImageList: null | SpuImage[];
}
// 数组 元素都是已有SPU数据类型
export type Records = SpuData[];
// SPU接口返回的数据类型
export interface HasSpuResponseData extends ResponseData {
  data: {
    records: Records;
    total: number;
    size: number;
    current: number;
    searchCount: boolean;
    pages: number;
  };
}

// 所有品牌数据的ts类型
export interface Trademark {
  id: number;
  tmName: string;
  logoUrl: string;
}

// 品牌接口返回的数据ts类型
export interface AllTradeMark extends ResponseData {
  data: Trademark[];
}

// 商品图片ts类型
export interface SpuImage {
  id: number;
  imgName: string;
  imgUrl: string;
  cteateTime?: string;
  updateTime?: string;
  spuId?: number;
}

// 服务器返回数据类型
export interface SpuHasImg extends ResponseData {
  data: SpuImage[];
}

// 销售属性ts类型
export interface SaleAttrValue {
  id?: number;
  createTime?: string;
  updateTime?: string;
  spuId?: number;
  baseSaleAttrId: number;
  saleAttrName: string;
  saleAttrValueName?: string;
  isChecked?: null;
}

// 存储已有的销售属性数组类型
export type spuSaleAttrValueList = SaleAttrValue[];

export interface SaleAttr {
  id?: number;
  createTime: null;
  updateTime: null;
  spuId: number;
  baseSaleAttrId: number;
  saleAttrName: string;
  spuSaleAttrValueList: spuSaleAttrValueList;
}

// 服务返回的接口类型
export interface SaleAttrResponseData extends ResponseData {
  data: SaleAttr[];
}

// 已有的全部spu的返回数据ts类型
export interface HasSaleAttr {
  id: number;
  name: string;
}

// 服务器返回数据类型
export interface HasSaleAttrResponseData extends ResponseData {
  data: HasSaleAttr[];
}
